#include <pthread.h>
#include <exception>

class Locker{
public:
    Locker(){
        if(pthread_mutex_init(&mtx, NULL) != 0){
            throw std::exception();
        }
    }
    ~Locker(){
        pthread_mutex_destroy(&mtx);
    }
    bool lock(){
        return pthread_mutex_lock(&mtx) == 0;
    }
    bool unlock(){
        return pthread_mutex_unlock(&mtx) == 0;
    }
private:
    pthread_mutex_t mtx;
};// 2-43-19

class Condition{
public:
    Condition(){
        if(pthread_cond_init(&cond, NULL) != 0){
            throw std::exception;
        }
    }

    ~Condition(){
        pthread_cond_destroy(&cond);
    }

    bool init(pthread_mutex_t * mtx){
        pthread_create()
        return pthread_cond_wait(&cond, mtx) == 0;
    }
    
private:
    pthread_cond_t cond;
};